﻿<Window x:Class="Aeon.Emulator.Launcher.ConfigEditor"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:emu="clr-namespace:Aeon.Presentation;assembly=Aeon.Presentation"
        xmlns:local="clr-namespace:Aeon.Emulator.Launcher"
        xmlns:pres="clr-namespace:Aeon.Presentation;assembly=Aeon.Presentation"
        x:Name="root" Title="Aeon Session Configuration" ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
        Icon="Aeon.ico" Height="400" Width="700" MinHeight="350" MinWidth="600">
    <Grid Margin="3">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="275" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <DockPanel>
            <TextBlock Text="Hardware" Foreground="DarkBlue" FontSize="16" DockPanel.Dock="Top" />
            <TreeView Name="hardwareTree" BorderBrush="Transparent">
                <TreeViewItem Header="Processor" IsExpanded="True">
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Speed:" />
                        <pres:NumericUpDown Width="60" Margin="0,2" MinimumValue="10" MaximumValue="100" StepValue="10" Value="{Binding Configuration.EmulationSpeed, ElementName=root}" />
                        <Label Content="%" />
                    </StackPanel>
                </TreeViewItem>
                <TreeViewItem Header="Input" IsExpanded="True">
                    <CheckBox Content="Noncapturing" IsChecked="{Binding Configuration.IsMouseAbsolute, ElementName=root}" />
                </TreeViewItem>
            </TreeView>
        </DockPanel>
        <StackPanel Orientation="Vertical" Grid.Column="1">
            <TextBlock Text="Disk Drives" Foreground="DarkBlue" FontSize="16" />
            <local:DiskMounter MinHeight="150" Margin="20,0,0,0" ItemsSource="{Binding Configuration.Drives, ElementName=root}" />
            <TextBlock Text="Startup" Foreground="DarkBlue" FontSize="16" />
            <Grid Margin="20,2,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="Initial Path:" VerticalAlignment="Center" Margin="0,0,5,0" />
                <TextBox Name="startupPathTextBox" Text="{Binding Configuration.StartupPath, ElementName=root}" Grid.Column="1" />
            </Grid>
            <Grid Margin="20,2,0,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <CheckBox Name="launchCheckBox" Content="Launch:" Margin="0,0,5,0" VerticalAlignment="Center" />
                <TextBox Name="launchTextBox" IsEnabled="{Binding IsChecked, ElementName=launchCheckBox}" Grid.Column="1" Text="{Binding Configuration.Launch, ElementName=root}" />
            </Grid>
            <StackPanel Orientation="Horizontal" Margin="0,10,0,0" HorizontalAlignment="Left">
                <Button Content="Save..." Width="50" Click="SaveButton_Click" />
                <Button Content="Load..." Width="50" Click="LoadButton_Click" Margin="5,0,0,0" Visibility="Collapsed" />
            </StackPanel>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Right">
            <Button Content="OK" Width="60" Height="21" Margin="0" IsDefault="True" Click="OKButton_Click">
                <Button.Style>
                    <Style TargetType="{x:Type Button}">
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Configuration.Drives.Count, ElementName=root}" Value="0">
                                <Setter Property="IsEnabled" Value="False" />
                            </DataTrigger>
                            <DataTrigger Binding="{Binding Configuration.HasErrors, ElementName=root}" Value="True">
                                <Setter Property="IsEnabled" Value="False" />
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </Button.Style>
            </Button>
            <Button Content="Cancel" Width="60" Height="21" Margin="5,0,0,0" IsCancel="True" />
        </StackPanel>
    </Grid>
</Window>
